package self.hoy.demo.cloud.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import self.hoy.demo.cloud.FeignConfiguration;
import self.hoy.demo.cloud.constant.ApplicationInterface;
import self.hoy.demo.cloud.entities.CommonResult;
import self.hoy.demo.cloud.entities.Payment;

/**
 * 代理provider的接口实现
 * 由provider的Controller实现，在consumer中注入
 */
@FeignClient(
        value = ApplicationInterface.PAYMENT_INSTANCE_NAME
//        , configuration = FeignConfiguration.class
)
public interface PaymentFeignService {

    @GetMapping("/payment/get/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    @GetMapping("/payment/timeout")
    String timeout();

    @PostMapping("/payment/create")
    CommonResult create(@RequestBody Payment payment);
}
